unit formmain;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

uses uakeebajson, superobject;

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
	enc : string;
	res : TAkeebaAutosniffStatus;
	ar  : TAkeebaReponseAPI;
	aj  : TAkeebaJSON;
begin
	aj := TAkeebaJSON.Create();
	aj.Password := 'test';
	res := aj.autoSniff('http://localhost/test');

	enc := 'No encryption (NONE)';
	case(res) of
		Encryption128:
			enc := '128-bit (LOW) AES-128 in CBC mode';
		Encryption256:
			enc := '256-bit (HIGH) AES-128 in CBC mode';
	end;

	ar := aj.getVersion;
	if(ar.Status <> AKEEBA_JSON_STATUS_OK) then
		MessageDlg('It doesn''t work', ar.ErrorMessage, mtInformation, [mbOK], -1)
	else
		MessageDlg('It works', enc + #13+#13+ IntToStr(ar.api) + #13 + ar.component + #13 + ar.date, mtInformation, [mbOK], -1);
end;

initialization
  {$I formmain.lrs}

end.

